#include "Circle.h"
#include <math.h>

Circle::Circle(float x,float y, float sizeX,float sizeY,DWORD color,int vertexCount,bool visible,char* name){
	vertices=new D3DVERTEX[vertexCount];
	vertices[0].x=x;
	vertices[0].y=y;
	vertices[0].color=color;
	for(int i =1;i<vertexCount;i++){
		double dAngle = (360.0/ ((double)vertexCount - 2) ) * (i - 1);
		double dAngSin = sin(dAngle * (3.141592654f / 180.0));
		double dAngCos = cos(dAngle * (3.141592654f / 180.0));
		vertices[i].x=x+dAngSin*sizeX;
		vertices[i].y=y+dAngCos*-sizeY;
		vertices[i].z=1;
		vertices[i].color=color;
	}
	Shape::Create(x,y,sizeX,sizeY,visible,name,vertexCount,D3DPRIMITIVETYPE::D3DPT_TRIANGLEFAN,vertices);
}

void Circle::Draw(Renderer* renderer){	
	Shape::Draw(renderer);
}